<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Compare time of two IntlCalendar objects for equality</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="intlcalendar.createinstance.html">IntlCalendar::createInstance</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="intlcalendar.fielddifference.html">IntlCalendar::fieldDifference</a></div>
 <div class="up"><a href="class.intlcalendar.html">IntlCalendar</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="intlcalendar.equals" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">IntlCalendar::equals</h1>
  <p class="verinfo">(PHP 5.5.0, PECL &gt;= 3.0.0a1)</p><p class="refpurpose"><span class="refname">IntlCalendar::equals</span> &mdash; <span class="dc-title">Compare time of two IntlCalendar objects for equality</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-intlcalendar.equals-description">
  <h3 class="title">说明</h3>
  <p class="para">
   面向对象风格
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><strong>IntlCalendar::equals</strong></span>
    ( <span class="methodparam"><span class="type"><a href="class.intlcalendar.html" class="type IntlCalendar">IntlCalendar</a></span> <code class="parameter">$other</code></span>
   )</div>

  <p class="para rdfs-comment">
   过程化风格
  </p>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>intlcal_equals</strong></span>
    ( <span class="methodparam"><span class="type"><a href="class.intlcalendar.html" class="type IntlCalendar">IntlCalendar</a></span> <code class="parameter">$cal</code></span>
   , <span class="methodparam"><span class="type"><a href="class.intlcalendar.html" class="type IntlCalendar">IntlCalendar</a></span> <code class="parameter">$other</code></span>
   )</div>

  <p class="para rdfs-comment">
   Returns true if this calendar and the given calendar have the same time.
   The settings, calendar types and field states do not have to be the same.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-intlcalendar.equals-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">cal</code></em></dt>

    <dd>

     <p class="para">
      The IntlCalendar resource.
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">other</code></em></dt>

    <dd>

     <p class="para">
      The calendar to compare with the primary object.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-intlcalendar.equals-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> if the current time of both this and the passed in
   <a href="class.intlcalendar.html" class="classname">IntlCalendar</a> object are the same, or <strong><code>FALSE</code></strong>
   otherwise. The value <strong><code>FALSE</code></strong> can also be returned on failure. This can only
   happen if bad arguments are passed in. In any case, the two cases can be
   distinguished by calling <span class="function"><a href="function.intl-get-error-code.html" class="function">intl_get_error_code()</a></span>.
  </p>
 </div>



 <div class="refsect1 examples" id="refsect1-intlcalendar.equals-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2530">
   <p><strong>Example #1 <span class="function"><strong>IntlCalendar::equals()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />ini_set</span><span style="color: #007700">(</span><span style="color: #DD0000">'date.timezone'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'UTC'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$cal1&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">createInstance</span><span style="color: #007700">(</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'es_ES'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cal2&nbsp;</span><span style="color: #007700">=&nbsp;clone&nbsp;</span><span style="color: #0000BB">$cal1</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">equals</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal2</span><span style="color: #007700">));&nbsp;</span><span style="color: #FF8000">//TRUE<br /><br />//The&nbsp;locale&nbsp;is&nbsp;not&nbsp;included&nbsp;in&nbsp;the&nbsp;comparison<br /></span><span style="color: #0000BB">$cal2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">createInstance</span><span style="color: #007700">(</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'pt_PT'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cal2</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setTime</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTime</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">equals</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal2</span><span style="color: #007700">));&nbsp;</span><span style="color: #FF8000">//TRUE<br /><br />//And&nbsp;set&nbsp;fields&nbsp;state&nbsp;is&nbsp;not&nbsp;included&nbsp;as&nbsp;well<br /></span><span style="color: #0000BB">$cal2</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">clear</span><span style="color: #007700">(</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">FIELD_YEAR</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">isSet</span><span style="color: #007700">(</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">FIELD_YEAR</span><span style="color: #007700">)&nbsp;==<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$cal2</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">isSet</span><span style="color: #007700">(</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">FIELD_YEAR</span><span style="color: #007700">));&nbsp;</span><span style="color: #FF8000">//FALSE<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">equals</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal2</span><span style="color: #007700">));&nbsp;</span><span style="color: #FF8000">//TRUE<br /><br />//Neither&nbsp;is&nbsp;the&nbsp;calendar&nbsp;type<br /></span><span style="color: #0000BB">$cal2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">createInstance</span><span style="color: #007700">(</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'es_ES@calendar=islamic'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$cal2</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setTime</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTime</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">equals</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal2</span><span style="color: #007700">));&nbsp;</span><span style="color: #FF8000">//TRUE<br /><br />//Only&nbsp;the&nbsp;time&nbsp;is<br /></span><span style="color: #0000BB">$cal2&nbsp;</span><span style="color: #007700">=&nbsp;clone&nbsp;</span><span style="color: #0000BB">$cal1</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$cal2</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setTime</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTime</span><span style="color: #007700">()&nbsp;+&nbsp;</span><span style="color: #0000BB">1.</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal1</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">equals</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal2</span><span style="color: #007700">));&nbsp;</span><span style="color: #FF8000">//FALSE</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="intlcalendar.createinstance.html">IntlCalendar::createInstance</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="intlcalendar.fielddifference.html">IntlCalendar::fieldDifference</a></div>
 <div class="up"><a href="class.intlcalendar.html">IntlCalendar</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
